package com.czp.role.mapper.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;

import com.czp.framework.mapper.BaseMapperSupport;
import com.czp.menu.model.Menu;
import com.czp.role.mapper.IRoleMapper;
import com.czp.role.model.RelationMenu;
import com.czp.role.model.Role;

/**
 * 【环 境】：J2SE 1.7
 * @author   柴志鹏	CHAIZP@GMAIL.COM
 * @version  version 1.0
 * @since    2014-6-16
 */
public class RoleMapperImpl extends BaseMapperSupport implements IRoleMapper {

	public List<Role> getRoleList(Role role, RowBounds bounds) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.role.mapper.IRoleMapper.getRoleList", role, bounds);
	}
	
	public int getRoleRecords(Role role) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.role.mapper.IRoleMapper.getRoleRecords", role);
	}

	public int insertRole(Role role) throws Exception {
		return this.getSqlSession().insert(
				"com.czp.role.mapper.IRoleMapper.insertRole", role);
	}
	
	public int updateRole(Role role) throws Exception {
		return this.getSqlSession().update(
				"com.czp.role.mapper.IRoleMapper.updateRole", role);
	}
	
	public int deleteRole(Role role) throws Exception {
		return this.getSqlSession().update(
				"com.czp.role.mapper.IRoleMapper.deleteRole", role);
	}
	
	public List<Menu> getRelationMenuList(Role role, RowBounds bounds) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.role.mapper.IRoleMapper.getRelationMenuList", role, bounds);
	}
	
	public int getRelationMenuRecords(Role role) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.role.mapper.IRoleMapper.getRelationMenuRecords", role);
	}
	
	public int deleteRelationMenu(RelationMenu relMenu) throws Exception {
		return this.getSqlSession().delete(
				"com.czp.role.mapper.IRoleMapper.deleteRelationMenu", relMenu);
	}
	
	public int insertRelationMenu(RelationMenu relMenu) throws Exception {
		return this.getSqlSession().insert(
				"com.czp.role.mapper.IRoleMapper.insertRelationMenu", relMenu);
	}
	
	public int matchAddRelationMenu(RelationMenu relMenu) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.role.mapper.IRoleMapper.matchAddRelationMenu", relMenu);
	}
	
	public List<Menu> queryRelationMenu(RelationMenu relMenu) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.role.mapper.IRoleMapper.queryRelationMenu", relMenu);
	}
	
}
